var LAreaData = [
    {
        "id": "2",
        "name": "济南区域",
        "child":
            [
                { "id": "2288", "name": "\u4e1c\u57ce\u533a" },
                { "id": "2301", "name": "\u5927\u5174\u533a" },
            ]
    }];
let schoolname = [
    {
        "id": 1,
        "depName": "艾克瑞特",
        "parentId": 0,
        "createTime": 1606544685000,
        "depType": null
    },
    {
        "id": 57,
        "depName": "济南区域",
        "parentId": 1,
        "createTime": 1608291744000,
        "depType": "区域"
    },
    {
        "id": 58,
        "depName": "玉函校区",
        "parentId": 57,
        "createTime": 1608291759000,
        "depType": "校区"
    },
    {
        "id": 59,
        "depName": "领秀城校区",
        "parentId": 57,
        "createTime": 1608426905000,
        "depType": "校区"
    },
    {
        "id": 60,
        "depName": "和谐校区",
        "parentId": 57,
        "createTime": 1608426922000,
        "depType": "校区"
    },
    {
        "id": 61,
        "depName": "恒隆校区",
        "parentId": 57,
        "createTime": 1608426950000,
        "depType": "校区"
    }
]

function transDate(list, idstr, pidstr) {
    var result = [], temp = {};
    for (i = 0; i < list.length; i++) {
        temp[list[i][idstr]] = list[i];//将nodes数组转成对象类型  
    }
    for (j = 0; j < list.length; j++) {
        tempVp = temp[list[j][pidstr]]; //获取每一个子对象的父对象  
        if (tempVp) {//判断父对象是否存在，如果不存在直接将对象放到第一层  
            if (!tempVp["child"]) tempVp["child"] = [];//如果父元素的nodes对象不存在，则创建数组  
            tempVp["child"].push(list[j]);//将本对象压入父对象的nodes数组  
        } else {
            result.push(list[j]);//将不存在父对象的对象直接放入一级目录  
        }
    }
    return result;
}

let schoolArr = transDate(schoolname, "id", "parentId");
console.log(schoolArr[0].child);